<!DOCTYPE html>
<html>
<head>
    <title>设备信息</title>
    #parse("sys/header.html")
</head>
<body>
<div id="rrapp" v-cloak>
    <div>
        <Row :gutter="16" style="margin: 8px 0px 0px 1px">
            <div class="search-group">
                <i-col span="4">
                    <i-input v-model="q.name" @on-enter="query" placeholder="名称"></i-input>
                </i-col>
                <i-button @click="query">查询</i-button>
                <i-button @click="reloadSearch">重置</i-button>
            </div>
        </Row>
        <table id="jqGrid"></table>
    </div>
</div>

<script>
    $(function () {
        $("#jqGrid").Grid({
            url: '../devmaintenplan/list?checkStatus=1',
            colModel: [
                {label: '设备编码', name: 'devCode', index: 'DEV_CODE', width: 80},
                {label: '版本', name: 'planVersion', index: 'PLAN_VERSION', width: 80},
                {
                    label: '实施频率', name: 'freRate', index: 'FRE_RATE', width: 80,
                    formatter: function (value) {
                        return sysEnums.FRERATE[value];
                    }
                }, // 0每天 1每周 2每个月 3每个季度 4每半年 5一年
                {label: '检查时间非生产', name: 'checkDateUprud', index: 'CHECK_DATE_UPRUD', width: 80},
                {label: '检查时间生产', name: 'checkDatePrud', index: 'CHECK_DATE_PRUD', width: 80},
                {label: '人次', name: 'perEv', index: 'PER_EV', width: 80},
                {label: '内容', name: 'planCon', index: 'PLAN_CON', width: 80},
                {label: '编制人', name: 'orgUserName', index: 'ORG_USER_NAME', width: 80},
                {label: '车间审核人', name: 'checkUserName', index: 'CHECK_USER_NAME', width: 80},
             /*   {label: '审核状态', name: 'checkStatus', index: 'CHECK_STATUS', width: 80,
                    formatter: function(value){
                        return sysEnums.CHECK_FLAG[value];
                    }
                },
                {label: '审核时间', name: 'checkDate', index: 'CHECK_DATE', width: 80,
                    formatter: function(value){
                        return transDate(value, "yyyy-MM-dd");
                    }
                },
                {label: 'PE授权人', name: 'okUserName', index: 'OK_USER_NAME', width: 80},
                {label: '批准状态', name: 'okStatus', index: 'OK_STATUS', width: 80,
                    formatter: function(value){
                        return sysEnums.CHECK_FLAG[value];
                    }
                },
                {label: '批准时间', name: 'okDate', index: 'OK_DATE', width: 80,
                    formatter: function(value){
                        return transDate(value, "yyyy-MM-dd");
                    }
                },*/
                {label: 'id', name: 'id', index: 'ID', key: true, hidden: true},
            ]
        });
    });

    let vm = new Vue({
        el: '#rrapp',
        data: {
            q: {
                name: ''
            }
        },
        methods: {
            query: function () {
                vm.reload();
            },
            reload: function (event) {
                vm.showList = true;
                let page = $("#jqGrid").jqGrid('getGridParam', 'page');
                $("#jqGrid").jqGrid('setGridParam', {
                    postData: {'name': vm.q.name},
                    page: page
                }).trigger("reloadGrid");
            },
            reloadSearch: function () {
                vm.q = {
                    name: ''
                };
                vm.reload();
            }
        }
    });
    var getDeviceInfo = function () {
        var ids = getSelectedRows("#jqGrid");

      //  console.log("....."+ids);
        var rowData
        var result=[]
        for(var i=0;i<ids.length;i++){
             rowData = $("#jqGrid").jqGrid('getRowData',ids[i]);
            /*console.log("....."+ids[i]);
            console.log("....."+rowData.devCode);*/
        result.push(rowData)
        }


        //ID默认存储
   //    $("jqGrid").jqGrid('setSelection',id1);

        // alert(ids);
        // let result = getSelectedRowData("#jqGrid");
        // var id = result.id;
        // if (id == null) {
        //     return false;
        // } else {
        //     return result;
        // }

        return result;
    }
</script>
</body>
</html>
